/**
 * Created with IntelliJ IDEA.
 * User: info
 * Email: guobin@ebigdata.org
 * Date: 2017/11/21
 * Time: 9:26
 * To change this template use File | Settings | File Templates.
 */
import http from '@http/http'

function servive () {
  let myServices = {}
  /* 获取角色列表 */
  myServices._getRoleList = () => {
    return http.GET('./api/job/list')
  }
  /* 获取学校及所属学院信息 */
  myServices._getSchoolOrganization = () => {
    return http.GET('./api/organization/getSchoolOrganization')
  }
  /* 根据父级id和组织类型获取组织信息 */
  myServices._getOrganization = (id, type) => {
    return http.GET(`./api/organization/getOrganization/${id}/${type}`)
  }
  /* 新建组织机构 */
  myServices._addOrganization = (data) => {
    return http.POST('./api/organization/add', data)
  }
  /* 编辑组织,只可修改名称和简称 */
  myServices._updateOrganization = (data) => {
    return http.POST('./api/organization/update', data)
  }
  /* 根据id删除组织，验证是否有下属组织，有不能删除 */
  myServices._deleteOrganization = (id) => {
    return http.GET(`./api/organization/delete/${id}`)
  }
  /* 根据专业id获取年级 */
  myServices._getGradesByMajor = (majorId) => {
    return http.GET(`./api/common/getGradesByMajor/${majorId}`)
  }
  /* 获取班级下的学生列表，带分页 */
  myServices._findByClassId = (data) => {
    return http.POST('./api/student/findByClassId', data)
  }
  /* 根据学生id删除班级学生 */
  myServices._deleteStudent = (studentId) => {
    return http.GET(`./api/student/delete/${studentId}`)
  }
  /* 获取所有的民族 */
  myServices._getNations = () => {
    return http.GET('./api/common/getNations')
  }
  /* 获取所有的政治面貌 */
  myServices._getPoliticStatus = () => {
    return http.GET('./api/common/getPoliticStatus')
  }
  /* 获取所有的省份 */
  myServices._getProvinces = () => {
    return http.GET('./api/common/getProvinces')
  }
  /* 获取所有的校区 */
  myServices._getCampus = () => {
    return http.GET('./api/common/getCampus')
  }
  /* 创建或者修改学生 */
  myServices._addOrUpdate = (data) => {
    return http.POST('./api/student/addOrUpdate', data)
  }
  /* 根据学生id查询学生信息 */
  myServices._findStudentInfoById = (studentId) => {
    return http.GET(`./api/student/findById/${studentId}`)
  }
  /* 获取管理人员列表 */
  myServices._getManagePersonList = (data) => {
    return http.POST('./api/manager/list', data)
  }
  /* 移动学生 */
  myServices._moveStudent = (data) => {
    return http.POST('./api/student/move', data)
  }
  /* 获取所有学院 */
  myServices._getColleges = () => {
    return http.GET('./api/common/getColleges')
  }
  /* 根据学员获取专业 */
  myServices._getMajorsByCollege = (collegeId) => {
    return http.GET(`./api/common/getMajorsByCollege/${collegeId}`)
  }
  /* 根据专业获取班级 */
  myServices._getClassesByMajor = (majorId) => {
    return http.GET(`./api/common/getClassesByMajor/${majorId}`)
  }
  /* 删除管理人员 */
  myServices._deleteManagePerson = (id) => {
    return http.POST(`./api/manager/manager/remove/${id}`)
  }
  /* 获取所有角色 */
  myServices._getAllRoles = () => {
    return http.GET('./api/job/getAllRoles')
  }
  /* 获取用户的所有角色 */
  myServices._getUserRoles = (userId) => {
    return http.GET(`./api/job/getUserRoles/${userId}`)
  }
  /* 修改用户角色 */
  myServices._updateUserRole = (roleInfo) => {
    return http.POST('./api/job/updateUserRole', roleInfo)
  }
  /* 查看管理人员详情 */
  myServices._getManagePersonDetail = (id) => {
    return http.GET(`./api/manager/detail/${id}`)
  }
  /* 查看管理人员管辖范围详情，带分页 */
  myServices._getDetailManagerScope = (data) => {
    return http.POST('./api/manager/detailManagerScope', data)
  }
  /* 删除管辖范围 */
  myServices._deleteManagerScope = (id) => {
    return http.POST(`./api/manager/deleteManagerScope/${id}`)
  }
  /* 批量新增学生 */
  myServices._uploadStudentExcel = (classId, file) => {
    return http.POST(`./api/student/uploadStudentExcel/${classId}`, {
      file
    })
  }
  /* 根据专业和年级来获取班级信息 */
  myServices._getClassesByMajorAndGrade = (majorId, grade) => {
    return http.GET(`./api/common/getClassesByMajorAndGrade/${majorId}/${grade}`)
  }
  /* 添加管理人员管辖范围 */
  myServices._addManagerScope = (data) => {
    return http.POST('./api/manager/addManagerScope', data)
  }
  /* 授权学生中根据学号筛选学生 */
  myServices._findBySnAndOnlyStudentRole = (sn) => {
    return http.GET(`./api/student/findBySnAndOnlyStudentRole/${sn}`)
  }
  /* 添加或者修改老师信息 */
  myServices._addOrUpdateTeacher = (data) => {
    return http.POST('./api/teacher/addOrUpdate', data)
  }
  /* 根据工号查询老师信息 */
  myServices._findTeacherBySn = (sn) => {
    return http.POST(`./api/teacher/findBySn/${sn}`)
  }
  /* 获取除学生外的所有角色 */
  myServices._getManagerRoles = () => {
    return http.GET('./api/manager/getManagerRoles')
  }
  /* 获取所有年级 */
  myServices._getAllGrade = () => {
    return http.GET('./api/common/getAllGrade')
  }
  /* 获取所有未冻结的角色 */
  myServices._getUnFreezeRoles = () => {
    return http.GET('./api/job/getUnFreezeRoles')
  }
  /* 根据学院获取所有年级 */
  myServices._getGradesByCollege = (collegeId) => {
    return http.GET(`./api/common/getGradesByCollege/${collegeId}`)
  }
  /* 授权学生 */
  myServices._giveStudentPower = (data) => {
    return http.POST('./api/manager/giveStudentPower', data)
  }
  return myServices
}

export default servive
